package com.bw.rjx.controller;

import com.bw.rjx.bean.ActivityReduceStats;
import com.bw.rjx.bean.CommodityIndicators;
import com.bw.rjx.service.GetDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("get")
public class GetDataController {
    @Autowired
    private GetDataService getDataService;

    @RequestMapping("test")
    public List<ActivityReduceStats> getDataTest(@RequestParam(value = "date", defaultValue = "1") Integer date){
        return getDataService.getActivityStats(date);
    }

    @RequestMapping("commodity/indicators")
    public List<CommodityIndicators> getDwdCommodityIndicators(
            @RequestParam(value = "shopId", defaultValue = "") String shopId,
            @RequestParam(value = "skuId", defaultValue = "") String skuId,
            @RequestParam(value = "dt", defaultValue = "") String dt) {
        System.out.println(shopId);
        System.out.println(skuId);
        System.out.println(dt);
        return getDataService.getCommodityIndicators(shopId, skuId, dt);
    }
}

//http://localhost:8070/get/commodity/indicators?shopId=shop_1&skuId=15&dt=2025-09-20